local genghuang = fk.CreateSkill({
    name = "sj7__genghuang",
})

Fk:loadTranslationTable{
  ["sj7__genghuang"] = "耕荒",
  [":sj7__genghuang"] = "你摸牌时可以少摸一张并进行判定，然后多摸手中与判定同颜色牌数张牌，每回合限一次。",
  
  ["$sj7__genghuang1"] = "勤耕陇亩地，并修德与身。",
  ["$sj7__genghuang2"] = "田垄不可废，耕读不可怠。",
  
  ["#sj7__genghuang-ask"] = "耕荒：你即将摸%arg张牌，你可以少摸一张牌以发动【耕荒】",
}

genghuang:addEffect(fk.BeforeDrawCard, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(genghuang.name) and data.num > 0 and player:usedSkillTimes(genghuang.name) == 0
end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player,{
      skill_name = genghuang.name,
      prompt = "#sj7__genghuang-ask:::"..data.num
    })
  end,
  on_use = function(self, event, target, player, data)
    local judge = {
      who = player,
      reason = genghuang.name,
    }
    player.room:judge(judge)
    data.num = data.num - 1 + #table.filter(player:getCardIds("h"),function (id)
      return Fk:getCardById(id).color == judge.card.color
    end)
  end,
})


return genghuang